<div class="modal-dialog ">
    <form method="post" class="form-horizontal" action="/admin/user/edituser" data-validate="parsley">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title">修改用户【{{user.real_name}}】</h4>
        </div>
        <div class="modal-body">

            <div class="form-group">
                <label class="col-sm-3 control-label">用户类型</label>

                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <label class="radio-inline i-checks">
                                <input type="radio" value="0" name="is_admin" {%if user.is_admin==0%}checked{%endif%}><i></i> 前台
                            </label><label class="radio-inline i-checks">
                            <input type="radio" value="1" name="is_admin" {%if user.is_admin==1%}checked{%endif%}><i></i> 后台
                        </label>
                        </div>
                        <div class="col-md-12">
                            <span class="help-block m-b-none"><span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 选择前台用户不能登陆后台管理</span></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group is_admin_group {%if user.is_admin==0%}hide{%endif%}">
                <label class="col-sm-3 control-label">管理组</label>

                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <select class="form-control " name="role_id">
                                {%for v in role%}
                                <option value="{{v.id}}" {%if v.id == roleid%} selected{%endif%}>{{v.desc}}</option>
                                {%endfor%}
                            </select>
                        </div>
                        <div class="col-md-12">
                            <span class="help-block m-b-none"><span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 选择后台时才生效</span></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group is_admin_group {%if user.is_admin==0%}hide{%endif%}">
                <label class="col-sm-3 control-label">用户名称</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="username" class="form-control input-sm" data-required="true" value="{{user.username}}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">用户姓名</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="real_name" class="form-control input-sm" data-required="true" value="{{user.real_name}}">
                        </div>
                    </div>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label" style="padding-top: 25px">头像</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <a href="#" class="pull-left thumb-md avatar b-3x m-r">
                                <img src="/u/avatar/{{user.id}}" alt="{{user.username}}">
                            </a>
                            <label class="checkbox-inline i-checks" style="padding-top: 25px">
                                <input type="checkbox" value="1" name="delavatar" ><i></i> 删除头像
                            </label>
                        </div>

                    </div>
                </div>
            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">密码</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <input type="password" name="password" class="input-sm form-control" placeholder="不修改密码请留空" >
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">确认密码</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <input type="password" class="input-sm form-control" placeholder="不修改密码请留空" name="repassword" >
                        </div>
                    </div>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">注册公司</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <select class="form-control pointer " name="company" required>
                                <option value="">-&#45;&#45; 选择公司 -&#45;&#45;</option>
                                {% for item in controller.companyList %}
                                <option value="{{item.id}}" {%if item.id==user.company%}selected{%endif%}>{{item.subcompanyname}}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </div>
            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">注册类型</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <label class="radio nomargin" style="display: inline-block;">
                                <input id="usertype-0" type="radio" name="org_type" value="0" {%if user.org_type=="0"%}checked{%endif%}><i></i>个人&nbsp;&nbsp;&nbsp;&nbsp;
                            </label>
                            <label class="radio nomargin" style="display: inline-block;">
                                <input id="usertype-1" type="radio" name="org_type" value="1" {%if user.org_type=="1"%}checked{%endif%}><i></i>企业(个体)
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">纳税人识别号</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="nsrsbh" class="form-control input-sm" data-required="true" value="{{user.nsrsbh}}" maxlength="20">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证号</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="user_code" class="form-control input-sm" data-required="true" value="{{user.user_code}}" maxlength="18">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">员工编号</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="ygbh" class="form-control input-sm" placeholder="OA员工编号，如果不是核心企业业务员，请留空" value="{{user.ygbh}}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">公司名称</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="gsmc" class="form-control input-sm" data-required="true" value="{{user.gsmc}}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">手机</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8">
                            <input type="text" name="mobile" class="form-control input-sm" data-type="number" value="{{user.mobile}}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">用户组</label>

                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <select class="form-control input-sm" name="groupid">
                                {%for v in usergroup%}
                                <option value="{{v.groupid}}" {%if v.groupid == user.groupid%} selected{%endif%}>{{v.name}}</option>
                                {%endfor%}
                            </select>
                        </div>
                        <div class="col-md-12">
                            <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否激活</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <label class="radio nomargin" style="display: inline-block;">
                                <input type="radio" name="user_active" value="0" {%if user.user_active=="0"%}checked{%endif%}><i></i>未激活&nbsp;&nbsp;&nbsp;&nbsp;
                            </label>
                            <label class="radio nomargin" style="display: inline-block;">
                                <input type="radio" name="user_active" value="1" {%if user.user_active=="1"%}checked{%endif%}><i></i>已激活
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否实名认证</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-8 ">
                            <label class="radio nomargin" style="display: inline-block;">
                                <input type="radio" name="zhucestatus" value="2" {%if user.zhucestatus=="2"%}checked{%endif%}><i></i>已认证&nbsp;&nbsp;&nbsp;&nbsp;
                            </label>
                            <label class="radio nomargin" style="display: inline-block;">
                                <input type="radio" name="zhucestatus" value="0" {%if user.zhucestatus=="0"%}checked{%endif%}><i></i>未认证
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <section class="panel panel-default m-b-xs">
                <header class="panel-heading">
                    <span class="label bg-danger pull-right m-t-xs"></span>
                    图片详情
                </header>
                <table class="table  m-b-none">
                    <thead>
                    </thead>
                    <tbody>
                    {% for u in url %}
                    <tr>
                        <span class=""><img class="img-responsive img-thumbnail" src="{{u}}" ></span>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </section>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">积分点数</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-4">
                            <input type="text" name="score" class="form-control input-sm" data-type="number" value="{{user.score}}">
                        </div>
                        <div class="col-md-12">
                            <span class="help-block m-b-none"><span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i>
                                积分点数将影响会员用户组</span></span>
                        </div>
                    </div>
                </div>
            </div>-->
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">vip会员</label>
                <div class="col-sm-9">
                    <div class="row">
                        <div class="col-md-12">
                                <div class="input-group">
                            <span class="input-group-addon" style="padding-top: 5px; padding-bottom: 3px">
                             <label class="checkbox-inline i-checks" style="padding-top: 0">
                                <input type="checkbox" value="1" name="vip" {% if user.vip==1%} checked{%endif%}><i></i> 是否为vip会员,过期时间
                            </label>
                          </span><input class="input-sm input-s time form-control" size="16" type="text" value="{% if user.vip==1%}{{user.overduedate|moment('YYYY-MM-DD HH:mm')}}{%endif%}"  name="overduedate">
                            </div>
                        </div>
                    </div>
                </div>
            </div>-->
        </div>
        <div class="modal-footer">
            <input type="hidden" value="{{user.id}}" name="id">
            <a href="javascript:;" class="btn btn-default" data-dismiss="modal">关闭</a>
            <button class="btn btn-primary btn-s-md ajax-post" type="submit" target-form="form-horizontal">确定</button>
        </div>
    </div><!-- /.modal-content -->
    </form>
</div><!-- /.modal-dialog -->
<script>
    $(function () {

        $('.time').datetimepicker({
            format: 'yyyy-mm-dd hh:ii',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });
        //用户组选择
        $("input[name='is_admin']").on("change",function () {
            var val = $(this).val();
            console.log(val);
            if(val == 1){
                $(".is_admin_group").removeClass('hide');
            }else {
                $(".is_admin_group").addClass('hide');
            }
        })
    })
</script>
